package com.tanhua.model.vo;

import com.tanhua.model.domain.Announcement;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AnnouncementVo {
    //标题
    private String id;
    //主题
    private String title;
    //描述
    private String description;
    //创建时间
    private String createDate;

    public static AnnouncementVo init(Announcement announcement){
        AnnouncementVo announcementVo = new AnnouncementVo();
        BeanUtils.copyProperties(announcement,announcementVo);
        announcementVo.setId(announcement.getId().toString());
        announcementVo.setCreateDate(announcement.getCreated().toString());
        return announcementVo;
    }
}
